<?php
/**
 * Created by PhpStorm.
 * User: Sky
 * Date: 2017/8/1
 * Time: 上午11:41
 */

$web = \yii\helpers\Url::base();
?>
<script type="text/javascript" src="<?= $web ?>/js/jcrop/jcrop.js"></script>
<script type="text/javascript" src="<?= $web ?>/js/jcrop/jcrop.single.js"></script>
<script type="text/javascript">
    $(function () {
        $("#inputIndustryType").change(function () {
            $("#industryType").val($(this).val());
        });

    });

    function clickFile() {
        $("#uploadImg").click();
    }
</script>
<div class="modal-body" id="auth_content">
    <div class="form-horizontal">
        <div class="form-group">
            <label class="col-lg-3 col-sm-3 control-label">行业类型：</label>
            <div class="col-lg-9">
                <label class="form-control"><?= $item['industry_type_name'] ?></label>
            </div>
        </div>

        <div class="form-group">
            <label class="col-lg-3 col-sm-3 control-label">标题：</label>
            <div class="col-lg-9">
                <label class="form-control"><?= $item['title'] ?></label>
            </div>
        </div>

        <div class="form-group">
            <label class="col-lg-3 col-sm-3 control-label">内容：</label>
            <div class="col-lg-9">
                <textarea class="form-control" readonly><?= $item['content'] ?></textarea>
            </div>
        </div>
        <!--上传广告展示图Begin -->
        <div class="form-group">
            <label class="col-lg-3 col-sm-3 control-label">广告展示图：</label>
        </div>
        <div class="form-group">
            <div class="col-lg-12">
                <label class="col-lg-3 col-sm-3 control-label"></label>
                <div class="col-lg-9">
                    <div id="imgSingle_Sure">
                        <div>
                            <input type="hidden" id="show_image_id" name="show_image_id"
                                   value="<?= isset($item['show_image']) ? $item['show_image']['id'] : '' ?>">
                            <?php if (isset($item['show_image'])): ?>
                                <img src="<?= $item['show_image']['url'] ?>" style="width: 200px">
                            <?php endif ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--上传广告展示图End -->

        <!--上传广告详情图Begin-->
        <div class="form-group">
            <label class="col-lg-3 col-sm-3 control-label">广告详情图：</label>
        </div>
        <div class="product-mod col-lg-10">
            <div class="col-lg-12">
                <label class="col-lg-3 col-sm-3 control-label"></label>
                <div class="col-lg-9">
                    <div id="Img_sure">
                        <?php if (isset($item['detail_images'])) {
                            foreach ($item['detail_images'] as $detail_image): ?>
                                <div class="tag-img-item upload-img-show">
                                    <input type="hidden" value="<?= $detail_image['id'] ?>" name="detail_images_ids[]">
                                    <span class="tag-img">
                                    <img src="<?= $detail_image['url'] ?>" style="width: 200px; height: 200px"/>
                                                                </span>
                                    <div class="del-icon" onclick="deleteImage(this)"></div>
                                </div>
                            <?php endforeach;
                        } ?>
                    </div>
                </div>
            </div>
        </div>
        <!--上传广告详情图End -->

        <div class="form-group">
            <label class="col-lg-3 col-sm-3 control-label">特殊行业广告认证资料：</label>
            <div class="col-lg-9">
                <img src="<?= $item['special']['file_url'] ?>"/>
            </div>
        </div>

        <div class="form-group">
            <label class="col-lg-3 col-sm-3 control-label">特殊行业广告认证费用：</label>
            <div class="col-lg-9">
                <label class="form-control"><?= $item['special']['pay_status'] ?></label>
            </div>
        </div>

        <?php
        if ($item['status'] == 10) {
            ?>
            <div class="form-group">
                <label class="col-lg-3 col-sm-3 control-label">审核意见：</label>
                <div class="col-lg-9">
                    <textarea class="form-control" id="authRemark" autofocus></textarea>
                </div>
            </div>
            <?php
        }
        ?>
    </div>
</div>
<div class="modal-footer">
    <?php
    if ($item['status'] == 10) {
        ?>
        <input type="hidden" id="hiddenAdId" value="<?= $id ?>">
        <button class="btn btn-success" id="btnAuthOk">审核通过</button>
        <button class="btn btn-danger" id="btnAuthFailed">审核失败</button>
        <?php
    }
    ?>
    <button class="btn btn-default" data-dismiss="modal">关闭</button>
</div>


<script type="application/javascript">
    (function () {

        $('#btnAuthOk').click(function () {
            var authId = $('#hiddenAdId').val();
            var authRemark = $('#authRemark').val().trim();
            requestJson('ad-auth-success-handler', {ad_id: authId, auth_remark: authRemark}, true, function (responseData) {
                if (responseData.status == 0) {
                    window.location.reload();
                }
            })
        });

        $('#btnAuthFailed').click(function () {
            var authId = $('#hiddenAdId').val();
            var authRemark = $('#authRemark').val().trim();
            requestJson('ad-auth-failed-handler', {ad_id: authId, auth_remark: authRemark}, true, function (responseData) {
                if (responseData.status == 0) {
                    window.location.reload();
                }
            })
        });

    })(jQuery);
</script>
